﻿<Application x:Class="JustPlus.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <Style TargetType="{x:Type Slider}">
            <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"/>
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Slider}">
                        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Width="{TemplateBinding Width}">
                            <Grid>
                                <Border CornerRadius="1">
                                    <Rectangle Margin="-2" Opacity="0.5" Fill="{TemplateBinding Foreground}" Height="2" />
                                </Border>
                                <Track x:Name="PART_Track">
                                    <Track.DecreaseRepeatButton>
                                        <RepeatButton Command="Slider.DecreaseLarge">
                                            <RepeatButton.Style>
                                                <Style TargetType="{x:Type RepeatButton}">
                                                    <Setter Property="OverridesDefaultStyle" Value="True"/>
                                                    <Setter Property="IsTabStop" Value="False"/>
                                                    <Setter Property="Focusable" Value="False"/>
                                                    <Setter Property="Background" Value="Transparent"/>
                                                    <Setter Property="Template">
                                                        <Setter.Value>
                                                            <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                                <Border Background="{TemplateBinding Background}"/>
                                                            </ControlTemplate>
                                                        </Setter.Value>
                                                    </Setter>
                                                </Style>
                                            </RepeatButton.Style>
                                        </RepeatButton>
                                    </Track.DecreaseRepeatButton>
                                    <Track.IncreaseRepeatButton>
                                        <RepeatButton Command="Slider.IncreaseLarge">
                                            <RepeatButton.Style>
                                                <Style TargetType="{x:Type RepeatButton}">
                                                    <Setter Property="OverridesDefaultStyle" Value="True"/>
                                                    <Setter Property="IsTabStop" Value="False"/>
                                                    <Setter Property="Focusable" Value="False"/>
                                                    <Setter Property="Background" Value="Transparent"/>
                                                    <Setter Property="Template">
                                                        <Setter.Value>
                                                            <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                                <Border Background="{TemplateBinding Background}"/>
                                                            </ControlTemplate>
                                                        </Setter.Value>
                                                    </Setter>
                                                </Style>
                                            </RepeatButton.Style>
                                        </RepeatButton>
                                    </Track.IncreaseRepeatButton>
                                    <Track.Thumb>
                                        <Thumb x:Name="Thumb">
                                            <Thumb.Style>
                                                <Style TargetType="{x:Type Thumb}">
                                                    <Setter Property="OverridesDefaultStyle" Value="True"/>
                                                    <Setter Property="Height" Value="6"/>
                                                    <Setter Property="Width" Value="6"/>
                                                    <Setter Property="Template">
                                                        <Setter.Value>
                                                            <ControlTemplate TargetType="{x:Type Thumb}">
                                                                <Border CornerRadius="5" x:Name="ForegroundRect">
                                                                    <Border.Effect>
                                                                        <DropShadowEffect Color="{TemplateBinding Foreground}" ShadowDepth="0" BlurRadius="5" />
                                                                    </Border.Effect>
                                                                    <Ellipse x:Name="ForegroundEllipse" Fill="{TemplateBinding Foreground}" Margin="-1" Opacity="1"/>
                                                                </Border>
                                                                <ControlTemplate.Triggers>
                                                                    <Trigger Property="IsMouseOver" Value="True">
                                                                        <Trigger.EnterActions>
                                                                            <BeginStoryboard>
                                                                                <Storyboard AutoReverse="True" RepeatBehavior="Forever">
                                                                                    <DoubleAnimation To="20" Duration="0:0:1" Storyboard.TargetName="ForegroundRect" Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.BlurRadius)" />
                                                                                </Storyboard>
                                                                            </BeginStoryboard>
                                                                        </Trigger.EnterActions>
                                                                        <Trigger.ExitActions>
                                                                            <BeginStoryboard>
                                                                                <Storyboard>
                                                                                    <DoubleAnimation To="5" Duration="0:0:0.2" Storyboard.TargetName="ForegroundRect" Storyboard.TargetProperty="(UIElement.Effect).(DropShadowEffect.BlurRadius)" />
                                                                                </Storyboard>
                                                                            </BeginStoryboard>
                                                                        </Trigger.ExitActions>
                                                                    </Trigger>
                                                                </ControlTemplate.Triggers>
                                                            </ControlTemplate>
                                                        </Setter.Value>
                                                    </Setter>
                                                </Style>
                                            </Thumb.Style>
                                        </Thumb>
                                    </Track.Thumb>
                                </Track>
                            </Grid>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style TargetType="{x:Type Button}">
            <Setter Property="BorderBrush" Value="Transparent"/>
            <Setter Property="FocusVisualStyle" Value="{x:Null}" />
            <Setter Property="Foreground" Value="Black"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Border x:Name="back">
                            <Border.Background>
                                <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                                    <GradientStop Color="Transparent" Offset="0.016" />
                                    <GradientStop Color="Transparent" Offset="1" />
                                    <GradientStop Color="#FFCCE0D4" Offset="0.311" />
                                    <GradientStop Color="#FFBAEA60" Offset="0.738" />
                                </LinearGradientBrush>
                            </Border.Background>
                            <ContentPresenter x:Name="content" HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Content}">
                            </ContentPresenter>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Trigger.EnterActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <DoubleAnimation From="0.6" To="1" Duration="0:0:0.2" Storyboard.TargetName="back" Storyboard.TargetProperty="Opacity" />
                                        </Storyboard>
                                    </BeginStoryboard>
                                </Trigger.EnterActions>
                                <Trigger.ExitActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <DoubleAnimation From="1" To="0.6" Duration="0:0:0.2" Storyboard.TargetName="back" Storyboard.TargetProperty="Opacity" />
                                        </Storyboard>
                                    </BeginStoryboard>
                                </Trigger.ExitActions>
                            </Trigger>
                            <Trigger Property="IsPressed" Value="True">
                                <Trigger.EnterActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <ColorAnimation To="#FF9DD421" Duration="0:0:0.1" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[2].(GradientStop.Color)" />
                                            <ColorAnimation To="#FF9DD421" Duration="0:0:0.1" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[3].(GradientStop.Color)" />
                                        </Storyboard>
                                    </BeginStoryboard>
                                </Trigger.EnterActions>
                                <Trigger.ExitActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <ColorAnimation To="#FFCCE0D4" Duration="0:0:0.1" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[2].(GradientStop.Color)" />
                                            <ColorAnimation To="#FFBAEA60" Duration="0:0:0.1" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.Background).(GradientBrush.GradientStops)[3].(GradientStop.Color)" />
                                        </Storyboard>
                                    </BeginStoryboard>
                                </Trigger.ExitActions>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style TargetType="{x:Type Label}" x:Key="GradLabel">
            <Setter Property="Foreground" Value="Black"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Label}">
                        <Border x:Name="backLabel">
                            <Border.Background>
                                <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
                                    <GradientStop Color="Transparent" Offset="0.016" />
                                    <GradientStop Color="Transparent" Offset="1" />
                                    <GradientStop Color="#FFCCE0D4" Offset="0.311" />
                                    <GradientStop Color="#FFBAEA60" Offset="0.738" />
                                </LinearGradientBrush>
                            </Border.Background>
                            <ContentPresenter x:Name="content" HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Content}">
                            </ContentPresenter>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="textboxPasswordboxStyles" TargetType="Control" >
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Control">
                        <Border x:Name="tbxBorder"  Background="#7FFFFFFF" CornerRadius="2" BorderThickness="{Binding (Control.BorderThickness), RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="#CC808080">
                            <ScrollViewer x:Name="PART_ContentHost"/>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Trigger.EnterActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <ColorAnimation To="#FFFFFFFF" Duration="0:0:0.1" Storyboard.TargetName="tbxBorder" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" />
                                        </Storyboard>
                                    </BeginStoryboard>
                                </Trigger.EnterActions>
                                <Trigger.ExitActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="tbxBorder" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" />
                                        </Storyboard>
                                    </BeginStoryboard>
                                </Trigger.ExitActions>
                            </Trigger>
                            <Trigger Property="IsFocused" Value="True">
                                <Trigger.EnterActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <ColorAnimation To="#FFFFBB00" Duration="0:0:0.1" Storyboard.TargetName="tbxBorder" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" />
                                            <ColorAnimation To="#FFFFFFFF" Duration="0:0:0.1" Storyboard.TargetName="tbxBorder" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" />
                                        </Storyboard>
                                    </BeginStoryboard>
                                </Trigger.EnterActions>
                                <Trigger.ExitActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="tbxBorder" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" />
                                            <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="tbxBorder" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" />
                                        </Storyboard>
                                    </BeginStoryboard>
                                </Trigger.ExitActions>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style TargetType="TextBox" BasedOn="{StaticResource textboxPasswordboxStyles}">
        </Style>
        <Style TargetType="PasswordBox" BasedOn="{StaticResource textboxPasswordboxStyles}">
        </Style>

    </Application.Resources>
</Application>
